package com.wentao.thisService;

import com.wentao.thisService.service.LocationService;
import com.wentao.thisService.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @Auther: ZhaiYanTao
 * @Date: 2020/3/26 18:48
 * @Description: 启动运行
 */
@Component
public class MyApplicationRunner implements ApplicationRunner {
    @Autowired
    private UserService userService;
    @Autowired
    private LocationService locationService;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.out.println("-------------省市区数据存redis开始-------------");
        locationService.putThreeLevelLocationToCache();
        System.out.println("-------------省市区数据存redis结束-------------");

        System.out.println("-------------用户数据存redis开始-------------");
        userService.initUserInfoToRedis();
        System.out.println("-------------用户数据存redis结束-------------");
    }
}
